import {screen} from 'electron'
# https://github.com/electron/electron/issues/7746

export default =>
  {x,y} = screen.getCursorScreenPoint()
  return [x,y]

###
mouseup_resolve = undefined
mouseup_promise = undefined

mouseup_promise_new = =>
  mouseup_promise = new Promise (resolve)=>
    mouseup_resolve = resolve
    return
  return

mouseup_promise_new()

do =>
  try
    evt = await import('iohook')
  catch err
    console.error(err)
    return
  evt.on 'mouseup',(e)=>
    if e.button == 1
      mouseup_resolve()
      mouseup_promise_new()
    return
  return


export mouseup = =>
  return mouseup_promise
###
